import request from "../utils/request";

class Pro{
  static getprolist = ()=> request.get("/goods")
  // 获取房源列表
  static getNavlist = ()=> request.get("/nav")
  // 获取nav列表
  static getcategory =async(categoryId)=>{
    let res = await request.get("/nav", { params: {categoryId} })
    return { data: { message: "获取房源类别成功",title:res.data[0].title }, code: 200 }
  }
  // 获取房源类别
  static addprolist = async(data)=>{
    let res = await request.post("/goods",data)    
    console.log(res);
    return { data: { message: "添加房源成功" }, code: 200 }
  }
  // 添加房源信息到列表
  static changeisshow = async(data)=>{
    let{id,isShow} = data
    let res = await request.patch("/goods/"+id,  {isShow:!isShow} )
    return { data: { message: "房源展示设置修改成功",data:res.data }, code: 200 }
  }
  // 修改房源展示信息
  static delprolist = async(id)=>{
    let res = await request.delete("/goods/"+id)
    console.log(res);
    return { data: { message: "删除房源信息成功" }, code: 200 }
  }
  // 删除房源信息
} 

export default Pro